package com.zds.advice;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/**
 * @className:MyAdvice
 * @date: 2025/6/12 上午12:35
 * @description:
 */
@Aspect
@Component
public class MyAdvice {
    @Pointcut("execution(* com.zds.service.impl.*.*(..))")
    public void logPointCut() {
    }
    @Before("logPointCut()")
    public void beforeAdvice() {
        System.out.println("beforeAdvice........");
    }
    @AfterReturning("logPointCut()")
    public void afterReturningAdvice() {
        System.out.println("afterReturningAdvice.......");
    }

    public void afterThrowingAdvice() {
    }
    @After("logPointCut()")
    public void afterAdvice() {
        System.out.println("afterAdvice");
    }
    @Around("logPointCut()")
    public Object aroundAdvice(ProceedingJoinPoint joinPoint) throws Throwable {
        System.out.println("aroundAdvicebefore");
        Object object = joinPoint.proceed();
        System.out.println("aroundAdviceafter");
        return object;
    }
}
